<?php
/**
 * 产品
 *
 * @author xyma
 *
 */
class Node
{
    public static function get($id)
    {
        return Db::get(__CLASS__)->select()->where(array('node_id'=>$id))->getOne();
    }

    public static function getList($where=null, $s=0, $l=20)
    {
        return Db::get(__CLASS__)->select()->where($where)->order('node_id DESC')->limit($s,$l)->getAll();
    }
    public static function count($where=null)
    {
        return Db::get(__CLASS__)->count()->where($where)->getCol();
    }

    public static function add($data)
    {
        return Db::get(__CLASS__)->insert($data)->exec() ? Db::get(__CLASS__)->insertId() : false;
    }
    public static function update($id, $data)
    {
        return Db::get(__CLASS__)->update($data)->where(array('node_id'=>$id))->exec();
    }

}
